<?php

/**
 * @Author: Wang chunsheng  email:2192138785@qq.com
 * @Date:   2023-07-21 09:16:37
 * @Last Modified by:   Wang chunsheng  email:2192138785@qq.com
 * @Last Modified time: 2023-07-21 09:22:23
 */


declare(strict_types=1);

namespace App\Api;

use Common\ApiController;
use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;

/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
#[AutoController(prefix: '/')]
class IndexController extends ApiController
{
    public array $signOptional = ['index'];

    public function index(RequestInterface $request, ResponseInterface $response): array
    {
        $user = $this->request->input('user', 'ddiot');
        $method = $this->request->getMethod();
//        $this->request->withAttribute('aa',['a'=>1]);
        return $this->writeJson(200, [
            'user' => $user,
            'method' => $method
        ], '欢迎使用店滴云物联网服务');
    }
}
